<script setup lang='ts'>

import NavBar from '../../components/NavBar.vue'
import { ref } from 'vue'

const codePopup = ref()
const codeBatchPopup = ref()
</script>

<template>
  <NavBar class="nav">
    <template v-slot:body>
      <view class="search">
        <view class="input" style="width: 436rpx;">
          <image mode="widthFix" class="icon" src="/static/image/navbar/search.png"/>
          <input placeholder="请输入产品名称" />
        </view>
      </view>
    </template>
  </NavBar>
  <view class="form nav-padding">
    <view class="form-item">
      <span class="label">机器编号</span>
      <input placeholder="请输入设备编号"/>
    </view>
    <view class="form-item">
      <span class="label">起始时间</span>
      <view class="arrow">
        <span>2023/04/28</span>
        <image src="/static/image/form/right_arrow.png" mode="widthFix" />
      </view>
    </view>
    <view class="form-item">
      <span class="label">结束时间</span>
      <view class="arrow">
        <span>2024/05/23</span>
        <image src="/static/image/form/right_arrow.png" mode="widthFix" />
      </view>
    </view>
    <view class="status">
      导出未过期、未撤销的取货单
    </view>
    <view class="form-action">
      <button class="btn">导出</button>
      <button class="btn" @click="codeBatchPopup?.open">批量取货码</button>
      <button class="btn primary">设置</button>
    </view>
  </view>
  <view class="outer">
    <view class="list">
      <view class="card">
        <view class="header">
          <view class="name">设备编号：100068</view>
        </view>
        <view class="body">
          <p class="code">取货码：KKDWH173778</p>
          <p>商品名称：农夫山泉</p>
          <p>商品数量：10</p>
          <p>失效时间：2024-06-21 15:56</p>
          <p>创建时间：2024-06-21 15:56</p>
        </view>
      </view>
      <view class="card">
        <view class="header">
          <view class="name">设备编号：100068</view>
        </view>
        <view class="body">
          <p class="code">取货码：KKDWH173778</p>
          <p>商品名称：农夫山泉</p>
          <p>商品数量：10</p>
          <p>失效时间：2024-06-21 15:56</p>
          <p>创建时间：2024-06-21 15:56</p>
        </view>
      </view>
    </view>
  </view>
  <view class="action">
    <button class="btn large" @click="codePopup?.open">新增提货码</button>
  </view>
  <uni-popup ref="codePopup" type="dialog">
    <uni-popup-dialog type="info" title="提货码" confirm-text="确定" cancel-text="取消" style="width: 500rpx">
      <view class="dialog-form">
        <view class="dialog-form-item">
          <span class="label">取货码</span>
          <input class="input" placeholder="请输入取货码"/>
        </view>
        <view class="dialog-form-item">
          <span class="label">设备</span>
          <view class="arrow">
            <span>请选择</span>
            <image src="/static/image/form/right_arrow.png" mode="widthFix" />
          </view>
        </view>
        <view class="dialog-form-item">
          <span class="label">失效时间</span>
          <view class="arrow">
            <span>2024-06-21 15:56</span>
            <image src="/static/image/form/right_arrow.png" mode="widthFix" />
          </view>
        </view>
      </view>
    </uni-popup-dialog>
  </uni-popup>
  <uni-popup ref="codeBatchPopup" type="dialog">
    <uni-popup-dialog type="info" title="批量新增" confirm-text="确定" cancel-text="取消" style="width: 550rpx">
      <view class="dialog-form">
        <view class="dialog-form-item">
          <span class="label">取货码数量</span>
          <input class="input" placeholder="请输入取货码"/>
        </view>
        <view class="dialog-form-item">
          <span class="label">设备</span>
          <view class="arrow">
            <span>请选择</span>
            <image src="/static/image/form/right_arrow.png" mode="widthFix" />
          </view>
        </view>
        <view class="dialog-form-item">
          <span class="label">失效时间</span>
          <view class="arrow">
            <span>2024-06-21 15:56</span>
            <image src="/static/image/form/right_arrow.png" mode="widthFix" />
          </view>
        </view>
      </view>
    </uni-popup-dialog>
  </uni-popup>
</template>

<style scoped lang='scss'>
.form {
  background-color: #fff;
  padding-bottom: 20rpx;
}
.status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #FF6619;
  padding: 24rpx 32rpx;
  font-size: 24rpx;
}
.form-action {
  display: flex;
  column-gap: 30rpx;
  justify-content: center;
  .btn {
    padding: 12rpx 48rpx;
  }
}
.card {
  background: #FFFFFF;
  box-shadow: inset 0rpx -1rpx 0rpx 0rpx #EBEEF1;
  border-radius: 8rpx 8rpx 0 0;
  margin: 24rpx 30rpx;
  .header {
    box-shadow: inset 0rpx -1rpx 0rpx 0rpx #EBEEF1;
    padding: 22rpx 0;
    display: flex;
    justify-content: space-between;
    .name {
      font-size: 28rpx;
      font-weight: bold;
      position: relative;
      margin-left: 26rpx;
      &:before {
        content: '';
        width: 6rpx;
        height: 40rpx;
        position: absolute;
        left: -26rpx;
        background: #FF4638;
        border-radius: 3rpx 3rpx 3rpx 3rpx;
      }
    }
    .status {
      color: #FF9832;
      font-size: 28rpx;
      margin-right: 30rpx;
    }
  }
  .body {
    padding: 32rpx 34rpx;
    box-shadow: inset 0rpx 1rpx 0rpx 0rpx #EBEEF1;
    font-size: 24rpx;
    color: #303030;
    .code {
      color: #FF9832;
    }
    p {
      display: flex;
      line-height: 24rpx;
      margin-bottom: 20rpx;
      font-weight: bold;
    }
  }
}
.action {
  background: #fff;
  padding: 10rpx 32rpx;
  position: fixed;
  bottom: 0;
  width: 100%;
  box-sizing: border-box;
  .btn {
    background: rgba(255,70,56,0.1);
    width: 100%;
    border: none;
  }
}
</style>